home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / Soundtracker Soundsystem.adf / sources / fastreplay.S < prev    next >
Text File  |  1988-10-29  |  6KB  |  383 lines

  1. ; -----------------------------------------------------------------
  2. ; ------- Mega fast playroutine for D.O.C-SoundTracker V2.1 -------
  3. ; -----------------------------------------------------------------
  4. ; ---------- Improved and omptimized by Unknown of D.O.C ----------
  5. ; --------------- Based on the playroutine from TJC ---------------
  6. ; -----------------------------------------------------------------
  7.  
  8. mt_init:lea    mt_data(pc),a0
  9.     add.l    #$01d8,a0
  10.     move.l    #$0080,d0
  11.     moveq    #$00,d1
  12. mt_init1:
  13.     move.l    d1,d2
  14.     subq.w    #1,d0
  15. mt_init2:
  16.     move.b    (a0)+,d1
  17.     cmp.b    d2,d1
  18.     bgt.s    mt_init1
  19.     dbf    d0,mt_init2
  20.     addq.b    #1,d2
  21.  
  22. mt_init3:
  23.     lea    mt_data(pc),a0
  24.     lea    mt_sample1(pc),a1
  25.     asl.l    #$08,d2
  26.     asl.l    #$02,d2
  27.     add.l    #$0258,d2
  28.     add.l    a0,d2
  29.     moveq    #$0e,d0
  30. mt_init4:
  31.     move.l    d2,(a1)+
  32.     moveq    #$00,d1
  33.     move.w    42(a0),d1
  34.     asl.l    #1,d1
  35.     add.l    d1,d2
  36.     add.l    #$1e,a0
  37.     dbf    d0,mt_init4
  38.  
  39.     lea    mt_sample1(pc),a0
  40.     moveq    #$00,d0
  41. mt_clear:
  42.     move.l    (a0,d0),a1
  43.     clr.l    (a1)
  44.     addq.l    #4,d0
  45.     cmp.l    #$3c,d0
  46.     bne.s    mt_clear
  47.  
  48.     clr.w    $dff0a8
  49.     clr.w    $dff0b8
  50.     clr.w    $dff0c8
  51.     clr.w    $dff0d8
  52.     clr.l    mt_partnrplay
  53.     clr.l    mt_partnote
  54.     clr.l    mt_partpoint
  55.  
  56.     move.b    mt_data+$1d6,mt_maxpart+1
  57.     rts
  58.  
  59. mt_end:    clr.w    $dff0a8
  60.     clr.w    $dff0b8
  61.     clr.w    $dff0c8
  62.     clr.w    $dff0d8
  63.     move.w    #$000f,$dff096
  64.     rts
  65.  
  66. mt_music:
  67.     addq.l    #1,mt_counter
  68. mt_cool:cmp.l    #6,mt_counter
  69.     bne.s    mt_notsix
  70.     clr.l    mt_counter
  71.     bra    mt_rout2
  72.  
  73. mt_notsix:
  74.     lea    mt_aud1temp(pc),a6
  75.     tst.b    3(a6)
  76.     beq.s    mt_arp1
  77.     lea    $dff0a0,a5        
  78.     bsr.s    mt_arprout
  79. mt_arp1:lea    mt_aud2temp(pc),a6
  80.     tst.b    3(a6)
  81.     beq.s    mt_arp2
  82.     lea    $dff0b0,a5
  83.     bsr.s    mt_arprout
  84. mt_arp2:lea    mt_aud3temp(pc),a6
  85.     tst.b    3(a6)
  86.     beq.s    mt_arp3
  87.     lea    $dff0c0,a5
  88.     bsr.s    mt_arprout
  89. mt_arp3:lea    mt_aud4temp(pc),a6
  90.     tst.b    3(a6)
  91.     beq.s    mt_arp4
  92.     lea    $dff0d0,a5
  93.     bra.s    mt_arprout
  94. mt_arp4:rts
  95.  
  96. mt_arprout:
  97.     move.b    2(a6),d0
  98.     and.b    #$0f,d0
  99.     tst.b    d0
  100.     beq.s    mt_arpegrt
  101.     cmp.b    #1,d0
  102.     beq.s    mt_portup
  103.     cmp.b    #2,d0
  104.     beq.s    mt_portdwn
  105.     rts
  106.  
  107. mt_portup:
  108.     moveq    #$00,d0
  109.     move.b    3(a6),d0
  110.     sub.w    d0,22(a6)
  111.     cmp.w    #$71,22(a6)
  112.     bpl.s    mt_ok1
  113.     move.w    #$71,22(a6)
  114. mt_ok1:    move.w    22(a6),6(a5)
  115.     rts
  116.  
  117. mt_portdwn:
  118.     moveq    #$00,d0
  119.     move.b    3(a6),d0
  120.     add.w    d0,22(a6)
  121.     cmp.w    #$358,22(a6)
  122.     bmi.s    mt_ok2
  123.     move.w    #$358,22(a6)
  124. mt_ok2:    move.w    22(a6),6(a5)
  125.     rts
  126.  
  127. mt_arpegrt:
  128.     cmp.l    #1,mt_counter
  129.     beq.s    mt_loop2
  130.     cmp.l    #2,mt_counter
  131.     beq.s    mt_loop3
  132.     cmp.l    #3,mt_counter
  133.     beq.s    mt_loop4
  134.     cmp.l    #4,mt_counter
  135.     beq.s    mt_loop2
  136.     cmp.l    #5,mt_counter
  137.     beq.s    mt_loop3
  138.     rts
  139.  
  140. mt_loop2:
  141.     moveq    #$00,d0
  142.     move.b    3(a6),d0
  143.     lsr.b    #4,d0
  144.     bra.s    mt_cont
  145. mt_loop3:
  146.     moveq    #$00,d0
  147.     move.b    3(a6),d0
  148.     and.b    #$0f,d0
  149.     bra.s    mt_cont
  150. mt_loop4:
  151.     move.w    16(a6),d2
  152.     bra.s    mt_endpart
  153. mt_cont:
  154.     asl.w    #1,d0
  155.     moveq    #$00,d1
  156.     move.w    16(a6),d1
  157.     lea    mt_arpeggio(pc),a0
  158. mt_loop5:
  159.     move.w    (a0,d0),d2
  160.     cmp.w    (a0),d1
  161.     beq.s    mt_endpart
  162.     addq.l    #2,a0
  163.     bra.s    mt_loop5
  164. mt_endpart:
  165.     move.w    d2,6(a5)
  166.     rts
  167.  
  168. mt_rout2:
  169.     lea    mt_data(pc),a0
  170.     move.l    a0,a3
  171.     add.l    #$0c,a3
  172.     move.l    a0,a2
  173.     add.l    #$1d8,a2
  174.     add.l    #$258,a0
  175.     move.l    mt_partnrplay,d0
  176.     moveq    #$00,d1
  177.     move.b    (a2,d0),d1
  178.     asl.l    #$08,d1
  179.     asl.l    #$02,d1
  180.     add.l    mt_partnote,d1
  181.     move.l    d1,mt_partpoint
  182.     clr.w    mt_dmacon
  183.  
  184.     lea    $dff0a0,a5
  185.     lea    mt_aud1temp(pc),a6
  186.     bsr    mt_playit
  187.     lea    $dff0b0,a5
  188.     lea    mt_aud2temp(pc),a6
  189.     bsr    mt_playit
  190.     lea    $dff0c0,a5
  191.     lea    mt_aud3temp(pc),a6
  192.     bsr    mt_playit
  193.     lea    $dff0d0,a5
  194.     lea    mt_aud4temp(pc),a6
  195.     bsr    mt_playit
  196.     move.w    #$008a,d1
  197. mt_loop:dbf    d1,mt_loop
  198.     move.w    #$8000,d0
  199.     or.w    mt_dmacon,d0
  200.     move.w    d0,$dff096
  201.  
  202.     lea    mt_aud4temp(pc),a6
  203.     cmp.w    #1,14(a6)
  204.     bne.s    mt_voice3
  205.     move.l    10(a6),$dff0d0
  206.     move.w    #1,$dff0d4
  207. mt_voice3:
  208.     lea    mt_aud3temp(pc),a6
  209.     cmp.w    #1,14(a6)
  210.     bne.s    mt_voice2
  211.     move.l    10(a6),$dff0c0
  212.     move.w    #1,$dff0c4
  213. mt_voice2:
  214.     lea    mt_aud2temp(pc),a6
  215.     cmp.w    #1,14(a6)
  216.     bne.s    mt_voice1
  217.     move.l    10(a6),$dff0b0
  218.     move.w    #1,$dff0b4
  219. mt_voice1:
  220.     lea    mt_aud1temp(pc),a6
  221.     cmp.w    #1,14(a6)
  222.     bne.s    mt_voice0
  223.     move.l    10(a6),$dff0a0
  224.     move.w    #1,$dff0a4
  225. mt_voice0:
  226.     move.l    mt_partnote,d0
  227.     add.l    #$10,d0
  228.     move.l    d0,mt_partnote
  229.     cmp.l    #$400,d0
  230.     bne.s    mt_stop
  231. mt_higher:
  232.     clr.l    mt_partnote
  233.     addq.l    #1,mt_partnrplay
  234.     moveq    #$00,d0
  235.     move.w    mt_maxpart,d0
  236.     move.l    mt_partnrplay,d1
  237.     cmp.l    d0,d1
  238.     bne.s    mt_stop
  239.     clr.l    mt_partnrplay
  240.  
  241. mt_stop:tst.w    mt_status
  242.     beq.s    mt_stop2
  243.     clr.w    mt_status
  244.     bra.s    mt_higher
  245. mt_stop2:
  246.     rts
  247.  
  248. mt_playit:
  249.     move.l    (a0,d1),(a6)
  250.     addq.l    #4,d1
  251.     moveq    #$00,d2
  252.     move.b    2(a6),d2
  253.     and.b    #$f0,d2
  254.     lsr.b    #4,d2
  255.     tst.b    d2
  256.     beq.s    mt_nosamplechange
  257.  
  258.     moveq    #$00,d3
  259.     lea    mt_samples(pc),a1
  260.     move.l    d2,d4
  261.     asl.l    #2,d2
  262.     mulu    #$1e,d4
  263.     move.l    (a1,d2),4(a6)
  264.     move.w    (a3,d4),8(a6)
  265.     move.w    2(a3,d4),18(a6)
  266.     move.w    4(a3,d4),d3
  267.     tst.w    d3
  268.     beq.s    mt_displace
  269.     move.l    4(a6),d2
  270.     add.l    d3,d2
  271.     move.l    d2,4(a6)
  272.     move.l    d2,10(a6)
  273.     move.w    6(a3,d4),8(a6)
  274.     move.w    6(a3,d4),14(a6)
  275.     move.w    18(a6),8(a5)
  276.     bra.s    mt_nosamplechange
  277.  
  278. mt_displace:
  279.     move.l    4(a6),d2
  280.     add.l    d3,d2
  281.     move.l    d2,10(a6)
  282.     move.w    6(a3,d4),14(a6)
  283.     move.w    18(a6),8(a5)
  284. mt_nosamplechange:
  285.     tst.w    (a6)
  286.     beq.s    mt_retrout
  287.     move.w    (a6),16(a6)
  288.     move.w    20(a6),$dff096
  289.     move.l    4(a6),(a5)
  290.     move.w    8(a6),4(a5)
  291.     move.w    (a6),6(a5)
  292.     move.w    20(a6),d0
  293.     or.w    d0,mt_dmacon
  294.  
  295. mt_retrout:
  296.     tst.w    (a6)
  297.     beq.s    mt_nonewper
  298.     move.w    (a6),22(a6)
  299.  
  300. mt_nonewper:
  301.     move.b    2(a6),d0
  302.     and.b    #$0f,d0
  303.     cmp.b    #11,d0
  304.     beq.s    mt_posjmp
  305.     cmp.b    #12,d0
  306.     beq.s    mt_setvol
  307.     cmp.b    #13,d0
  308.     beq.s    mt_break
  309.     cmp.b    #14,d0
  310.     beq.s    mt_setfil
  311.     cmp.b    #15,d0
  312.     beq.s    mt_setspeed
  313.     rts
  314.  
  315. mt_posjmp:
  316.     not.w    mt_status
  317.     moveq    #$00,d0
  318.     move.b    3(a6),d0
  319.     subq.b    #$01,d0
  320.     move.l    d0,mt_partnrplay
  321.     rts
  322.  
  323. mt_setvol:
  324.     move.b    3(a6),8(a5)
  325.     rts
  326.  
  327. mt_break:
  328.     not.w    mt_status
  329.     rts
  330.  
  331. mt_setfil:
  332.     moveq    #$00,d0
  333.     move.b    3(a6),d0
  334.     and.b    #$01,d0
  335.     rol.b    #$01,d0
  336.     and.b    #$fd,$bfe001
  337.     or.b    d0,$bfe001
  338.     rts
  339.  
  340. mt_setspeed:
  341.     move.b    3(a6),d0
  342.     and.b    #$0f,d0
  343.     beq.s    mt_back
  344.     clr.l    mt_counter
  345.     move.b    d0,mt_cool+5
  346. mt_back:rts
  347.  
  348. mt_aud1temp:
  349.     blk.w    10,0
  350.     dc.w    $0001
  351.     blk.w    2,0
  352. mt_aud2temp:
  353.     blk.w    10,0
  354.     dc.w    $0002
  355.     blk.w    2,0
  356. mt_aud3temp:
  357.     blk.w    10,0
  358.     dc.w    $0004
  359.     blk.w    2,0
  360. mt_aud4temp:
  361.     blk.w    10,0
  362.     dc.w    $0008
  363.     blk.w    2,0
  364. mt_partnote:    dc.l    0
  365. mt_partnrplay:    dc.l    0
  366. mt_counter:    dc.l    0
  367. mt_partpoint:    dc.l    0
  368. mt_samples:dc.l    0
  369. mt_sample1:blk.l 15,0
  370. mt_maxpart:dc.w    $0000
  371. mt_dmacon:dc.w    $0000
  372. mt_status:dc.w    $0000
  373.  
  374. mt_arpeggio:
  375. dc.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c
  376. dc.w $023a,$021a,$01fc,$01e0,$01c5,$01ac,$0194,$017d
  377. dc.w $0168,$0153,$0140,$012e,$011d,$010d,$00fe,$00f0
  378. dc.w $00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097
  379. dc.w $008f,$0087,$007f,$0078,$0071,$0000,$0000,$0000
  380.  
  381. mt_data:
  382. blk.b    0,0
  383.